//
//  OFPhoto_VC.swift
//  OfferManager
//
//  Created by IT.Bear on 2018/1/4.
//  Copyright © 2018年 OFFER. All rights reserved.
//

import UIKit
import SnapKit

class OFPhoto_VC: XXBaseViewController,XXFilerGroupViewDelegate,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout {
    
    //    MARK:懒加载
    lazy var menuItemView :XXFilterGroupView = {
        let view = XXFilterGroupView.init(frame: CGRect(x:0,y:64,width:XXScreenWidth,height:44), targetController: self)
        view.delegate? = self
        return view
    }()
    
    lazy var collection :UICollectionView = {
        let layout = UICollectionViewFlowLayout.init()
        layout.sectionInset = UIEdgeInsetsMake(10, 0, 0, 0)
        layout.minimumLineSpacing = 1
        layout.minimumInteritemSpacing = 0.5
        let collectionView = UICollectionView.init(frame: CGRect.zero, collectionViewLayout: layout)
        collectionView.backgroundColor = Color_White
        return collectionView
    }()
    
    //    MARK:-
    override func viewDidLoad() {
        super.viewDidLoad()
        self.title = "图库"
        loadUI()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    //MARK:-
    //MARK:布局
    func loadUI() {
        self.view.addSubview(self.menuItemView)
        self.view.addSubview(self.collection)
        self.view.sendSubview(toBack: self.collection)
        self.collection.delegate = self
        self.collection.dataSource = self
        layout()
    }
    
    func layout() {
        self.collection.snp.makeConstraints { (make) in
            make.top.equalTo(self.menuItemView.snp.bottom)
            make.left.right.bottom.equalTo(0)
        }
    }
    
    //MARK:-
    //MARK:CollectionViewDelegate
    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return 10
    }
    
    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        return OFPhotoCell.cellWithCollectionView(collectionView, indexPath)
    }
    
    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
        return OFPhotoCell.caculateSize()
    }
    
    //MARK:-
    //MARK:Delegate
    func handleSortClick() {
        
    }
    
    func handleFilterClick() {
        
    }
    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
